// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 创建订单 POST /orders */
export async function createOrder(body: API.OrderFormDTO, options?: { [key: string]: any }) {
  return request<number>('api/orders', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 根据id查询订单 GET /orders/${param0} */
export async function queryOrderById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.queryOrderByIdParams,
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.OrderVO>(`/orders/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 根据id删除订单 DELETE /orders/${param0} */
export async function deleteOrderById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.deleteOrderByIdParams,
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/orders/${param0}`, {
    method: 'DELETE',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 分页查询订单 POST /orders/list */
export async function queryOrderByPage(body: API.OrderPageQuery, options?: { [key: string]: any }) {
  return request<API.PageResponseOrderVO>('api/orders/list', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 各个状态的订单数量统计 GET /orders/statistics */
export async function statistics(options?: { [key: string]: any }) {
  return request<API.CommonResultOrderStatisticsVO>('api/orders/statistics', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 修改订单转态 PUT /orders/status/${param0}/${param1} */
export async function updateOrderStatus(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.updateOrderStatusParams,
  options?: { [key: string]: any },
) {
  const { id: param0, status: param1, ...queryParams } = params;
  return request<any>(`api/orders/status/${param0}/${param1}`, {
    method: 'PUT',
    params: { ...queryParams },
    ...(options || {}),
  });
}
